package Stream;

import java.util.stream.Stream;

public class Stream6 {
    public static void main(String[] args) {
        Stream<String> stream = Stream.of("狗","人","鸡","鸭","鹅");
        //使用limit方法截取
        Stream<String> stream2 = stream.limit(3);
        stream2.forEach((String s)->{
            System.out.println(s);
        });
        //截取前3个元素
    }
}
